package network;


import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
import java.io.IOException;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author ggroff
 */
public class Server_torrent {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
//        System.out.println("Veuillez saisir l'ip : ");
//        String ip = sc.nextLine();
        System.out.println("Veuillez saisir le port : ");
        int port = sc.nextInt();

        try {
            ServerSocket server = new ServerSocket(port);
            System.out.println("Serveur en écoute sur le port " + port);


            while (true) {
                Socket socket = server.accept();
                System.out.println(socket.getInetAddress().getHostAddress());
                
                Flux.Envoyer(socket);
            }
        } catch (IOException e) {
            System.out.println("Erreur : " + e.getMessage());
        }
    }
}
